<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // ES6允许在大括号中写入变量和函数,作为对象属性和方法
        let name = "lili"
        let age = "20"

        // 以往对象写法
        const school = {
            // 键值
            name: name,
            age: age,
            fn: function () {
                console.log('原始方法声明');

            }
        }

        // 现在简写
        const student = {
            name,
            age,
            fn() {
                console.log('现在对象写法');
            }
        }

        console.log(school, student);

    </script>

</body>

</html>